﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
    <!--------------------
LOGIN FORM
by: Amit Jakhu
www.amitjakhu.com
--------------------->
    <!--META-->
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <title>Login-Training</title>
    <!--STYLESHEETS-->
    <link href="styles/loginnew.css" rel="stylesheet" type="text/css" />
    <!--SCRIPTS-->
    <script src="scripts/jquery-1.9.0.min.js" type="text/javascript"></script>
    <script src="scripts/jquery-ui-1.9.2.custom.min.js" type="text/javascript"></script>
    <script src="scripts/jquery.sha1.js" type="text/javascript"></script>
    <script src="<%= ResolveUrl("~/scripts/jquery.msgBox.v1.js") %>" type="text/javascript"></script>
    <link rel="stylesheet" href="styles/blitzer/jquery-ui-1.9.2.custom.min.css" type="text/css" />
    <link rel="shortcut icon" href="images/favicon_favicon.png">
    <link rel="stylesheet" href="styles/button.css" type="text/css" />
    <!--Slider-in icons-->
    <script type="text/javascript">
        $(document).ready(function () {
            $("#txtKode").focus(function () {
                $(".user-icon").css("left", "-48px");
            });
            $("#txtKode").blur(function () {
                $(".user-icon").css("left", "0px");
            });

            $("#txtPassword").focus(function () {
                $(".pass-icon").css("left", "-48px");
            });
            $("#txtPassword").blur(function () {
                $(".pass-icon").css("left", "0px");
            });
        });
    </script>
    <script type="text/javascript">
        $(document).ready(function () {
            $('#btnMasuk').click(function () {

                var kode = $('#txtKode').val();
                var pwd = $('#txtPassword').val();
                var isPersistent = $('#cbIsPersistent').is(":checked");
                var objUser = new Object();
                objUser.UserCode = encodeURIComponent(kode);
                objUser.IsPersistent = isPersistent;

                if (typeof ($('#txtPassword').val()) != 'undefined')
                    objUser.Password = encodeURIComponent($.sha1($('#txtPassword').val()));

                jsonData = JSON.stringify(objUser);

                $.ajax({
                    type: 'POST',
                    url: 'ajaxhandler/authentication/loginhandler.ashx',
                    contentType: 'application/json',
                    dataType: 'json',
                    data: jsonData,
                    success: function (data) {

                        if (data.IsValid == 'True') {

                            window.location = data.DefaultUrl;

                        }
                        else {
                            alert(data.Message);
                            // $.msgBox(data.Message, null, { title: "Pesan Error" });
                        }

                    },
                    error: function (response) {
                        var r = JSON.parse(response.responseText);
                        alert("Error Message: " + r.Message);
                        //$.msgBox("Error Message: " + r.Message, null, { title: "Pesan Error" });
                    }
                });

                return false;

            });

        });

    </script>
</head>
<body>
    <!--WRAPPER-->
    <div id="wrapper">
        <!--SLIDE-IN ICONS-->
        <div class="user-icon">
        </div>
        <div class="pass-icon">
        </div>
        <!--END SLIDE-IN ICONS-->
        <!--LOGIN FORM-->
        <form name="login-form" class="login-form" action="" method="post">
        <!--HEADER-->
        <div class="header">
            <h1>
                Login
            </h1>
            <span style="font-size:large;">Sistem Informasi Training</span>
            <br />
            <span style="font-size:15px;">PT.Fastrata Buana</span>
        </div>
        <!--END HEADER-->
        <!--CONTENT-->
        <div class="content">
            <!--USERNAME-->
            <input name="txtKode" id="txtKode" type="text" class="input username" placeholder="Email"
                onfocus="this.value=''" /><!--END USERNAME-->
            <!--PASSWORD-->
            <input name="txtPassword" id="txtPassword" type="password" class="input password"
                placeholder="Password" onfocus="this.value=''" /><!--END PASSWORD-->
        </div>
        <!--END CONTENT-->
        <!--FOOTER-->
        <div class="footer">
            <!--LOGIN BUTTON-->
            <input type="submit" id="btnMasuk" name="btnMasuk" value="Login" class="button" /><!--END LOGIN BUTTON-->
            <!--REGISTER BUTTON-->
            <%--<input type="submit" name="submit" value="Register" class="register" />--%><!--END REGISTER BUTTON-->
        </div>
        <!--END FOOTER-->
        </form>
        <!--END LOGIN FORM-->
    </div>
    <!--END WRAPPER-->
    <!--GRADIENT-->
    <div class="gradient">
    </div>
    <!--END GRADIENT-->
</body>
</html>
